package cn.tedu.charging.cost.controller;


import cn.tedu.charging.common.result.JsonResult;
import cn.tedu.charging.common.pojo.param.ChargingProcessParam;
import cn.tedu.charging.common.pojo.vo.ChargingProcessVO;
import cn.tedu.charging.cost.service.CostService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@RestController
@RequestMapping("v1/cost/")
@Api(tags = "价格服务")
public class CostController {

    @Autowired
    private CostService costService;



    @PostMapping("cacle")
    public JsonResult<ChargingProcessVO> cacleChargingPrice(@RequestBody ChargingProcessParam chargingProcessParam){
        log.debug("计算价格参数 chargingProcessParam = {}",chargingProcessParam);
        ChargingProcessVO chargingProcessVo = costService.cacleChargingPrice(chargingProcessParam);
        return JsonResult.ok(chargingProcessVo);
    }
}
